
package com.zsrt.day20170504.ch07;

public class Customer extends Thread{

	private Producer tick;
	
	public Customer( Producer p) {
		tick = p;
	}
	
	@Override
	public void run(){
		while(true){
			
			try {
				String string = tick.sell(Thread.currentThread().getName());
				if(string ==null){
					break;
				}
				System.out.println(string);
				sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
	
}
